<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="utf-8">
    <title>Title</title>
    <script src="/js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript">
    function myFunction(ele) {
		var hour = parseInt((ele.duration)/3600);
		var minute = parseInt((ele.duration%3600)/60);
		var second = Math.ceil(ele.duration%60);
		document.getElementById("getDuration").innerHTML="这段视频的时长为："+hour+"小时，"+minute+"分，"+second+"秒";
		$("#seconds").val(Math.floor(ele.duration));
    }  
    function changeFile(ele){  
    	var video = ele.files[0];  
	    var url = URL.createObjectURL(video);  
	    document.getElementById("aa").src = url;
	} 
    $(function(){
    	$("input[name=upload]").on("change",function(){
        	changeFile(this);
        });
    })
    
    </script>
</head>
<body>
<form action="/upload_submit" method="post" enctype="multipart/form-data">
	<video style="display:none;" controls="controls" id="aa" oncanplaythrough="myFunction(this)">
	   	
	   </video>
    <input type="file" name="upload"/>
    <span id="getDuration"></span>
    <input type="hidden" id="seconds" name="seconds">
<br/><br/>
    <input type="submit" value="提交">
</form>
</body>
</html>
